
#ifndef ANIMATED_SPRITE_H
#define ANIMATED_SPRITE_H

// INCLUDES ********************************************************************

#include "Sprite.h"

#include "Rectangle.h"

#include <vector>

// FORWARD DECLARATIONS ********************************************************

/*******************************************************************************
 
 TODO: 
 
*******************************************************************************/

// *****************************************************************************

//! AnimtedSprite
//! 
//! Sprite class using spritesheets for animated display of objects. Animations
//! will have to be ordered from top to bottom, with their frame going from
//! left to right

/*******************************************************************************

    Example of a spritesheet with two animations ( for example, walking and 
    looking), each with two frames
    This allows for different numbers of frame in each animation, as long as
    the current number of frames is updated accordingly.
    
        ________________
        |    |    |    |
    A1  | F1 | F2 | F3 |
        |____|____|____|
        ________________
        |    |    |    |
    A2  | F1 | F2 | F3 |
        |____|____|____|

*******************************************************************************/

// *****************************************************************************

namespace Meteor 
{
    class AnimatedSprite : public Sprite
    {
        public:
            AnimatedSprite( const std::string& fileName,
                            const int numFrames, 
                            const Vector2D& frameSize);
        
            AnimatedSprite( const AnimatedSprite& sprite);
        
            virtual ~AnimatedSprite();
                        
            //! time a complete animation ( all steps) will take
            void SetAnimationTime( const float time);
            
            const float AnimationTime() const;
        
            //! set the number of frames used to animation
            void SetCurrentAnimation( const uint32_t animation);
            
            //! set the number of frames used to animation
            void SetNumFrames( const uint32_t numFrames);
            
            //! the current frame will be set in this function, depending on
            //! the delta time passed
            void Update(  const float deltaTime);
        
        private:
            //! time the animation takes in total
            float mAnimationTime;
        
            //! if there are multiple animations within one image
            //! this will be the one used
            int mCurrentAnimation;
        
            Vector2D mFrameSize;
        
            //! number of frames the animation contains
            int mNumFrames;
            
            //! the Rectangle that will be set as the textures Rectangle,
            //! using the current x offset ( width * frame)
            Rectangle mFrameRect;
            

            
    }; // end of class AnimatedSprite

} // end of namespace Meteor

#endif
